From b29feb193eac97c9cc31f33290bf3731757f4cb2 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 9 Oct 2019 14:46:36 -0700 Subject: [PATCH] gl: use memcmp to compare glyph cache keys We can just use memcmp here because even in the use of lookup keys with C99 initializers, we can rely on any space between fields added by the compiler to be zeroed. So we might as well use wider memory cmopares. --- gsk/gl/gskglglyphcache.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/gsk/gl/gskglglyphcache.c b/gsk/gl/gskglglyphcache.c index 5e31369057..d1cf5b06f7 100644 --- a/gsk/gl/gskglglyphcache.c +++ b/gsk/gl/gskglglyphcache.c @@ -11,6 +11,7 @@ #include #include #include +#include /* Cache eviction strategy * @@ -78,14 +79,7 @@ gsk_gl_glyph_cache_unref (GskGLGlyphCache *self) static gboolean glyph_cache_equal (gconstpointer v1, gconstpointer v2) { - const GlyphCacheKey *key1 = v1; - const GlyphCacheKey *key2 = v2; - - return key1->font == key2->font && - key1->glyph == key2->glyph && - key1->xshift == key2->xshift && - key1->yshift == key2->yshift && - key1->scale == key2->scale; + return memcmp (v1, v2, sizeof (GlyphCacheKey)) == 0; } static guint -- 2.30.2